package com.kstech.exccheck.fragment;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.kstech.exccheck.R;
import com.kstech.exccheck.domain.check.CheckItemDetailEntity;
import com.kstech.exccheck.domain.check.CheckItemDetailStatusEnum;
import com.kstech.exccheck.domain.check.CheckItemParamValueVO;
import com.kstech.exccheck.util.AppContext;
import com.kstech.exccheck.view.upload.Globals;

/**
 * Created by lijie on 2016/12/10.
 */

public class ItemDataView extends LinearLayout {
    private CheckItemDetailEntity body;
    private Context context;
    public ItemDataView(Context context ,CheckItemDetailEntity body) {
        super(context);
        this.body = body;
        this.context = context;
        init();
    }

    public ItemDataView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public ItemDataView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }
    private void init(){
        this.setOrientation(HORIZONTAL);
        View view = View.inflate(context,R.layout.fragment_list_data_item,null);
        TextView tv = (TextView) view.findViewById(R.id.data);
        tv.setText(body.getCheckTime());
        this.addView(view);
        for (CheckItemParamValueVO param:body.getParam()){
            View viewp = View.inflate(context,R.layout.fragment_list_data_item,null);
            TextView tvp = (TextView) viewp.findViewById(R.id.data);
            tvp.setText(param.getValue());
            this.addView(viewp);
        }
        View viewc = View.inflate(context,R.layout.fragment_list_data_item,null);
        TextView tvc = (TextView) viewc.findViewById(R.id.data);
        tvc.setText(body.getCheckerCode());
        this.addView(viewc);
    }
}
